Repository navigation
hash's measured table: Emscripten linked at its optimization level, WASI without host-dependent debug information - #23
Merged
Conversation
added 2 commits
November 16, 2026 13:53
…ble is measured with Emscripten programs linked at their optimization level main's measure lane failed: "hkdf_extract over hmac_sha2_512 on emscripten: by size hash2, sodium, committed sodium, hash2". The committed table was measured before PR 18 linked emscripten programs at their compile's level of optimization, at em++'s -O0 (121,510 and 119,420 bytes); linked at -Os they are 21,083 and 24,591. The sizes do not depend on the host: the two programs built on macOS arm64 and in a linux/amd64 container with Emscripten 6.0.11 are byte-identical. The table is measured again on main, which moves that order and three Emscripten throughput orders.
…s debug information, and libs/hash links its WASI programs without it wasi-sdk's prebuilt libc++ carries DWARF naming the include paths of the machine that built the release, /Users/runner/work/wasi-sdk/... in the macOS archive and /src/src/... in the Linux one, so a WASI program's .wasm was 128 to 2,000 bytes larger on macOS than on Linux, and a WebAssembly order, which the measure lane compares on every host, could flip with the host. measure.py --check and --write now read each WebAssembly program's custom sections, through every core module and component a wasip2 component nests, and fail naming each program for size that has a .debug section and test/measure/Jamfile, which links WASI programs with --strip-debug at libs/hash's head (hash_measure_test's test_a_webassembly_program_with_debug_information_fails). RULES says the .wasm carries no debug information. libs/hash moves to the head that links them so and measures the table again: every wasip2 and wasip3 size changes, and libsodium becomes smaller than hash2 for hkdf_expand and hkdf on WASI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves libs/hash to webcpporg/hash#2 (two commits) and changes tools/hash/measure.py and its test.
The measure lane failed on webcpp's main (run 43883027557, job "Own lane (hash, measure)"):
Root cause
-Osgives the committed 121,510 bytes exactly. Linked at-Os, as main does, hash2 is 21,083 bytes and libsodium 24,591, so hash2 is now the smaller one. The Mac reproduces CI's failure message exactly on main./Users/runner/work/wasi-sdk/...in the macOS archive and/src/src/...in the Linux one. The result: 58 of the 146 WASI cells were 128 to 2,000 bytes larger on macOS than in a linux/amd64 container with the same wasi-sdk 34. For example,space-hkdf_extract_hash2_hmac_sha2_256on wasip2 was 440,872 bytes on macOS and 439,848 on Linux. The debug sections were most of each program: that one is 59,161 bytes without them.Fix
test/measure/Jamfilelinks every WASI program with-Wl,--strip-debug. Emscripten's-Oslink keeps no debug section already, and natively the size is the stripped executable.tools/hash/measure.py(--checkand--write) reads each WebAssembly program's custom sections, including every core module and component a wasip2 component nests. It fails, naming each program for size that has a.debug*section. The test came first:test_a_webassembly_program_with_debug_information_fails. RULES now says the .wasm carries no debug information.python3 tools/hash/measure.py --writeon an idle machine (loaded: false), and the guide's generated tables were rewritten withdoc_tables.py --write. Orders that change:Host independence
__FILE__strings of wasi-sdk's libc++abi (fallback_malloc.cpp,private_typeinfo.cpp) in the data section. These are real program bytes, so they cannot be stripped. No order can flip on them: the smallest gap between adjacent backends in any WebAssembly order is 1,212 bytes. Removing the residual would take one host-independent wasi-sysroot on every host, which is a toolchain decision outside this change.Verification
libs/hash/test/measure//measure, from scratch:tools/test/hash_measure_test.py(16 cases) andhash_doc_tables_test.pyok;doc_tables.py --checkok; Pyright clean on both changed files.-a, libs/hash/test and example): native 153 passed, wasip2 151, wasip3 151, Emscripten 118.Remaining: wasi-sdk's libc++ debug information also inflates every webcpp WASI release program. Whether release links should strip it is a separate decision, not made here. bench/'s
doc/measurements.throughput.jsonwas measured before PR 18 as well and was not re-run.🤖 Generated with Claude Code